import 'package:taonile/generated/json/base/json_field.dart';
import 'package:taonile/generated/json/goods_source_list_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class GoodsSourceListEntity {
  late int code = 0;
  late String msg;
  late List<GoodsSourceListData> data = [];

  GoodsSourceListEntity();

  factory GoodsSourceListEntity.fromJson(Map<String, dynamic> json) =>
      $GoodsSourceListEntityFromJson(json);

  Map<String, dynamic> toJson() => $GoodsSourceListEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class GoodsSourceListData {
  late String id;
  late String name;
  @JSONField(name: "img_path")
  late String imgPath;
  @JSONField(name: "source_key")
  late String sourceKey;
  late String sort;
  @JSONField(name: "switch")
  late String xSwitch;
  @JSONField(name: "created_at")
  late String createdAt;
  @JSONField(name: "updated_at")
  late String updatedAt;

  GoodsSourceListData();

  factory GoodsSourceListData.fromJson(Map<String, dynamic> json) =>
      $GoodsSourceListDataFromJson(json);

  Map<String, dynamic> toJson() => $GoodsSourceListDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
